package goclient

import "io"

type Response struct {
	StatusCode    int32
	Status        string
	ContentType   string
	ContentLength int32
	Body          ReadCloser
	Header        *Header
}

func (r *Response) ReadAsBinary() ([]byte, error) {
	return io.ReadAll(r.Body)
}

func (r *Response) ReadAsText() (string, error) {
	data, err := io.ReadAll(r.Body)
	if err != nil {
		return "", err
	}
	return string(data), err
}

func (r *Response) WriteTo(w Writer) error {
	_, err := io.Copy(w, r.Body)
	return err
}
